///
/// Override the ${Add Button}_Click and add a new record row.
///
public override void ${Add Button}_Click(object sender, ImageClickEventArgs args)
{
try
{
DbUtils.StartTransaction();
// First, save the data on the editable table.
this.SaveData();
this.Page.CommitTransaction(sender);
// Add an empty row to the editable table.
this.AddNewRecord = 1;
}
catch (Exception ex)
{
// Report error message to the user
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "UNIQUE_SCRIPTKEY", ex.Message);
this.Page.RollBackTransaction(sender);
}
finally
{
DbUtils.EndTransaction();
}
}
|